<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:xs="http://www.w3.org/2001/XMLSchema"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:nwisdocs="http://wales.nhs.uk/nwis/docs"
	exclude-result-prefixes="xs xsi">
	
	<xsl:template name="actions">
		<div class="boxed-section" id="{local-name()}">
        <h2>Advice, recommendations and future plans</h2>
        <div class="inline-content">
          <h3>Hospital</h3>

          <xsl:choose>
            <xsl:when test="count(nwisdocs:DocumentBody/nwisdocs:AdviceRecommendPlan/nwisdocs:HospitalActions/*) &gt; 0">
              <ul>
                <xsl:for-each select="nwisdocs:DocumentBody/nwisdocs:AdviceRecommendPlan/nwisdocs:HospitalActions/nwisdocs:Action">
                  <li>
                    <xsl:value-of select="nwisdocs:Narrative"/>
                  </li>
                </xsl:for-each>
              </ul>
            </xsl:when>
            <xsl:otherwise>None recorded</xsl:otherwise>
          </xsl:choose>
          

          <h3>GP</h3>
          <xsl:choose>
            <xsl:when test="count(nwisdocs:DocumentBody/nwisdocs:AdviceRecommendPlan/nwisdocs:GPactions/*) &gt; 0">
              <ul>
                <xsl:for-each select="nwisdocs:DocumentBody/nwisdocs:AdviceRecommendPlan/nwisdocs:GPactions/nwisdocs:Action">
                  <li>
                    <xsl:value-of select="nwisdocs:Narrative"/>
                  </li>
                </xsl:for-each>
              </ul>
            </xsl:when>
            <xsl:otherwise>None recorded</xsl:otherwise>
          </xsl:choose>
          

          <h3>Community and specialist services</h3>
          <xsl:choose>
            <xsl:when test="count(nwisdocs:DocumentBody/nwisdocs:AdviceRecommendPlan/nwisdocs:OtherServiceActions/*) &gt; 0">
              <ul>
                <xsl:for-each select="nwisdocs:DocumentBody/nwisdocs:AdviceRecommendPlan/nwisdocs:OtherServiceActions/nwisdocs:Action">
                  <li>
                    <xsl:value-of select="nwisdocs:Narrative"/>
                  </li>
                </xsl:for-each>
              </ul>
            </xsl:when>
            <xsl:otherwise>None recorded</xsl:otherwise>
          </xsl:choose>

        </div>
      </div>


    <xsl:choose>
      <xsl:when test="count(nwisdocs:DocumentBody/nwisdocs:AdviceRecommendPlan/nwisdocs:InformationToPatient/*) &gt; 0">
    <div class="boxed-section" id="{local-name()}">
      <h2>Information given to patient, family and carers</h2>
      <div class="inline-content">
        <ul>
          <xsl:for-each select="nwisdocs:DocumentBody/nwisdocs:AdviceRecommendPlan/nwisdocs:InformationToPatient/nwisdocs:Action">
            <li>
              <xsl:value-of select="nwisdocs:Narrative"/>
            </li>
          </xsl:for-each>
        </ul>
      </div>
      </div>
      </xsl:when>
    </xsl:choose>

  </xsl:template>
		
</xsl:stylesheet>
